%% theorem environment is base on elegantbook.cls
%% start of file `elegantbook.cls'.
%% Copyright 2013-2019 ElegantLaTeX (elegantlatex2e@gmail.com)
%%
%% This work may be distributed and/or modified freely
%% available at https://github.com/ElegantLaTeX/ElegantBook
\usepackage{tcolorbox}
\tcbuselibrary{most}
\usepackage{manfnt,bbding}
\tcbset{
    common/.style={
        fontupper=\textit,
        lower separated=false,
        coltitle=white,
        colback=gray!5,
        boxrule=0.5pt,
        fonttitle=\bfseries,
        enhanced,
        breakable,
        top=8pt,
        before skip=8pt,
        attach boxed title to top left={yshift=-0.11in,xshift=0.15in},
        boxed title style={boxrule=0pt,colframe=white,arc=0pt,outer arc=0pt},
        separator sign={.},
    },
    defstyle/.style={
        common,
        colframe=main,  
        colback=main!5,
        colbacktitle=main, 
        overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{main}{$\clubsuit$}}; }
    },
    thmstyle/.style={
        common,
        colframe=second,  
        colback=second!5,
        colbacktitle=second, 
        overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{second}{$\heartsuit$}}; }
    },
    propstyle/.style={
        common,
        colframe=third,  
        colback=third!5,
        colbacktitle=third, 
        overlay unbroken and last={\node[anchor=south east, outer sep=6pt] at (\textwidth-width,0) {\textcolor{third}{$\spadesuit$}}; }
    },
}

\newtcbtheorem[auto counter,number within=chapter]{definition}{\definitionTitle}{defstyle}{def}
\newtcbtheorem[auto counter,number within=chapter]{theorem}{\theoremTitle}{thmstyle}{thm}
\newtcbtheorem[auto counter,number within=chapter]{proposition}{\propositionTitle}{propstyle}{pro}
\newtcbtheorem[auto counter,number within=chapter]{corollary}{\corollaryTitle}{thmstyle}{cor}
\newtcbtheorem[auto counter,number within=chapter]{lemma}{\lemmaTitle}{thmstyle}{lem}

% main（green-def): example exercise problem solution
% second（orange-thm）: proof note remark  
% third（blue-prop):  assumptions property conclusion custom

%% Example with counter
\newcounter{exam}[chapter]
\setcounter{exam}{0}
\renewcommand{\theexam}{\thechapter.\arabic{exam}}
\newenvironment{example}[1][]{
 		\refstepcounter{exam}\par\noindent\textbf{\color{main}{
 			\exampleTitle
 		}\theexam #1 }\rmfamily %
 	}{
 		\par\medskip\ignorespacesafterend %
 	}

%% Exercise with counter
\newcounter{exer}[chapter]
\setcounter{exer}{0}
\renewcommand{\theexer}{\thechapter.\arabic{exer}}
\newenvironment{exercise}[1][]{
 		\refstepcounter{exer}\par\noindent\makebox[-3pt][r]{\scriptsize\color{red!90}\HandPencilLeft\quad}\textbf{\color{main}{
 			\exerciseTitle
 		}\theexer #1 }\rmfamily %
 	}{
 		\par\medskip\ignorespacesafterend %
 	}

%% Exercise with counter
\newcounter{prob}[chapter]
\setcounter{prob}{0}
\renewcommand{\theprob}{\thechapter.\arabic{prob}}
\newenvironment{problem}[1][]{
 		\refstepcounter{prob}\par\noindent\textbf{\color{main}{%
 			\problemTitle
 		}\theprob #1 }\rmfamily %
 	}{
 		\par\medskip\ignorespacesafterend %
 	}



\newenvironment{note}{\par\noindent{\makebox[0pt][r]{\scriptsize\color{red!90}\textdbend\quad}\textbf{\color{second}
	\noteTitle
}}\itshape}{\par}

\newenvironment{proof}{\par\noindent\textbf{\color{second}
	\proofTitle
}\color{black!90}\small}{
%\hfill$\Box$\quad
\par}
\newenvironment{remark}{\noindent\textbf{\color{second}
	\remarkTitle
}}{\par}
\newenvironment{assumption}{\par\noindent\textbf{\color{third}
	\assumptionTitle
}}{\par}
\newenvironment{conclusion}{\par\noindent\textbf{\color{third}
	\conclusionTitle
}}{\par}
\newenvironment{solution}{\par\noindent\textbf{\color{main}
	\solutionTitle
}\itshape}{\vskip2ex\par}
\newenvironment{property}{\par\noindent\textbf{\color{third}
	\propertyTitle
}}{\par}
\newenvironment{custom}[1]{\par\noindent\textbf{\color{third}
	#1
}}{\par}